<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/15
 * Time: 22:18
 */

namespace App\Library\form_builder\src\traits;
use App\Library\form_builder\src\components\Select;

trait SelectTrait
{
    /**
     * 下拉选择组件
     *
     * @param        $field
     * @param        $title
     * @param string $value
     * @return Select
     */
    public static function select($title,$field, $value = '')
    {

       // $multiple = is_array($value) ? true : false;
        $select = new Select($title,$field, $value);
        return $select;
    }
    /**
     * 多选
     *
     * @param       $field
     * @param       $title
     * @param array $value
     * @return Select
     */
    public static function selectMultiple($title,$field, array $value = [])
    {
        return self::select($title,$field, $value);
    }
    /**
     * 单选
     *
     * @param        $field
     * @param        $title
     * @param string $value
     * @return Select
     */
    public static function selectOne($title,$field, $value = '')
    {
        return self::select($title,$field, (string)$value);
    }
}